import { createRouter, createWebHashHistory } from 'vue-router';

export default createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      // 主页
      path: '/',
      // 懒加载
      component: () => import('@/views/home/index.vue'),
      children: [
        {
        // 首页
          name: '首页',
          path: '/',
          component: () => import('@/views/home/homepage/index.vue'),
        },
        {
          name: '分类',
          path: '/category/:id',
          component: () => import('@/views/home/category/index.vue'),
        },
        {
          name: '二级分类',
          path: '/category/sub/:id',
          component: () => import('@/views/home/sub-category/index.vue'),
        },
        {
          name: '商品详情',
          path: '/goods/:id',
          component: () => import('@/views/home/magnify/index.vue'),
        },
        {
          name: '购物车',
          path: '/cart',
          component: () => import('@/views/home/shopping-cart/index.vue'),
        },

      ],
    },
    {
      // 登录
      path: '/login',
      component: () => import('@/views/login/index.vue'),
    }],
});
